var app = getApp();

Page({
  data: {
    isLoading: false,
    title: '',
    author: '',
    time: '',
    content: ''
  },
  onLoad: function(opt) {
    var that = this;
    wx.showLoading({
      title: '加载中',
    });
    this.getArtDetail(opt.newId);
  },
  getArtDetail: function (id) {
    var that = this;
    wx.request({
      url: app.globalData.apiBaseUrl + '/medicalPopular/selectMedicalPopular',
      header: {
        'content-type': 'application/x-www-form-urlencoded; charset=utf-8',
        'FilterToken_MT': wx.getStorageSync("token")
      },
      method: 'POST',
      data: {
        id: id
      },
      dataType: 'json',
      success: function (msg) {
        msg = msg.data;
        if (msg.code == 200) {
          that.setData({
            title: msg.data.title,
            author: msg.data.createUser,
            time: msg.data.createTime,
            content: msg.data.content,
            isLoading: true
          })
          wx.hideLoading();
        } else {
          wx.hideLoading();
          wx.showToast({
            title: msg.msg,
            icon: 'none',
            duration: 3000
          })
        }
      }
    })
  }
});